/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-09-21
 * Time:21:32
 */

import java.util.Scanner;

public class Demo13 {
    static class Counter {
        public int count = 0;
    }

    public static void main(String[] args) {
        Counter counter = new Counter();

        Thread t1 = new Thread(() -> {
            while (counter.count == 0) {

            }
            System.out.println("t1 执行结束. ");
        });
        t1.start();

        Thread t2 = new Thread(() -> {
            System.out.println("请输入一个 int: ");
            Scanner scanner = new Scanner(System.in);
            counter.count = scanner.nextInt();
        });
        t2.start();
    }
}

